package com.s3s.ssm.view.cashier;

import java.util.Arrays;
import java.util.List;

import org.jdesktop.swingx.JXMultiSplitPane;
import org.jdesktop.swingx.MultiSplitLayout.ColSplit;
import org.jdesktop.swingx.MultiSplitLayout.Divider;
import org.jdesktop.swingx.MultiSplitLayout.Leaf;
import org.jdesktop.swingx.MultiSplitLayout.Node;
import org.jdesktop.swingx.MultiSplitLayout.RowSplit;
import org.jdesktop.swingx.MultiSplitLayout.Split;

public class CashierScreen extends JXMultiSplitPane {
	private static final long serialVersionUID = 1L;
	private static final int DEF_DIVIDER_SIZE = 3;
	private static final String RIGHT_MIDDLE = "right.middle";
	private static final String RIGHT_TOP = "right.top";
	private static final String RIGHT_BOTTOM = "right.bottom";
	private static final String LEFT_BOTTOM = "left.bottom";
	private static final String LEFT_MIDDLE = "left.middle";
	private static final String LEFT_TOP = "left.top";

	public CashierScreen() {
		ColSplit leftCol = new ColSplit();
		ColSplit rightCol = new ColSplit();

		leftCol.setWeight(0.5);
		rightCol.setWeight(0.5);
		setDividerSize(DEF_DIVIDER_SIZE);

		List<Node> leftChildren = Arrays.asList(new Leaf(LEFT_TOP),
				new Divider(), new Leaf(LEFT_MIDDLE), new Divider(), new Leaf(
						LEFT_BOTTOM));
		List<Node> rightChildren = Arrays.asList(new Leaf(RIGHT_TOP),
				new Divider(), new Leaf(RIGHT_MIDDLE), new Divider(), new Leaf(
						RIGHT_BOTTOM));

		leftCol.setChildren(leftChildren);
		rightCol.setChildren(rightChildren);

		Split modelRoot = new RowSplit();
		modelRoot.setChildren(leftCol, new Divider(), rightCol);

		getMultiSplitLayout().setModel(modelRoot);
		add(new InvoiceScreen(), LEFT_TOP);
		add(new AreaPanel(), LEFT_MIDDLE);
		add(new TablePane(), LEFT_BOTTOM);
		add(new DishGroupPanel(), RIGHT_TOP);
		add(new DishPanel(), RIGHT_MIDDLE);
		add(new CalculatorPanel(), RIGHT_BOTTOM);
	}

}
